package com.k.ums.controller;

import com.k.ums.model.SysUser;
import com.k.ums.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * Desc:
 *
 * @author: keen
 * Date: 2019-06-30
 * Time: 19:29
 */

@RequestMapping("/user")
@RestController
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @GetMapping("/{id}")
    public SysUser selectUser(@PathVariable Integer id) {
        return sysUserService.selectById(id);
    }

    @PostMapping("/add")
    public String addUser(@RequestBody SysUser sysUser) {
        return sysUserService.insert(sysUser) > 0 ? "成功" : "失败";
    }
}
